<?php

$mysqli = @new mysqli("localhost", "root", "root","school");

if($mysqli->connect_errno>0){
    exit("数据库链接失败,失败的原因：代码：".$mysqli->connect_errno.'错误信息:'.$mysqli->connect_error);
}

$mysqli->query("set names utf8");

// 预准备(预查询)
// 
$stmt = $mysqli->prepare("INSERT INTO stu (name,age) VALUES (?, ?)");


if($stmt){

    $stmt->bind_param('si', $name, $age);

    for ($i=0; $i <200 ; $i++) { 

        $name= "学并思".$i;

        $age = 19;

        $stmt->execute();

    }

}
// for ($i=0; $i <1000 ; $i++) { 

//     $sql = "insert into stu (name,age) values('学并思".$i."','18')";

//     $mysqli->query($sql);
// }
